// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import merge from 'lodash/merge.js';

import { expandColorDictionary } from '../utils/index.js';
import { StyleDictionary } from '../utils/interfaces.js';
import { tokens as parentTokens } from '../visual-refresh/colors.js';

const tokens: StyleDictionary.ColorsDictionary = {
  colorGreyOpaque70: 'rgba(255, 255, 255, 0.7)',
  colorGreyTransparent: { light: 'rgba(0, 28, 36, 0.3)', dark: 'rgba(0, 0, 0, 0.3)' },
  colorGreyTransparentHeavy: { light: 'rgba(0, 28, 36, 0.5)', dark: 'rgba(0, 0, 0, 0.5)' },
  colorGreyTransparentLight: { light: 'rgba(0, 28, 36, 0.15)', dark: 'rgba(0, 0, 0, 0.3)' },
  colorBackgroundButtonLinkActive: { light: '{colorNeutral250}', dark: '{colorNeutral950}' },
  colorBackgroundButtonLinkHover: { light: '{colorNeutral100}' },
  colorBackgroundButtonNormalActive: { light: '{colorNeutral250}', dark: '{colorNeutral950}' },
  colorBackgroundButtonNormalDefault: { dark: '{colorNeutral750}' },
  colorBackgroundButtonNormalDisabled: { dark: '{colorNeutral750}' },
  colorBackgroundButtonNormalHover: { light: '{colorNeutral100}' },
  colorBackgroundToggleButtonNormalPressed: { light: '{colorNeutral250}', dark: '{colorNeutral950}' },
  colorBackgroundButtonPrimaryActive: { light: '{colorPrimary1000}', dark: '{colorPrimary300}' },
  colorBackgroundButtonPrimaryDefault: { light: '{colorPrimary600}', dark: '{colorPrimary300}' },
  colorBackgroundButtonPrimaryDisabled: { light: '{colorWhite}', dark: '{colorNeutral750}' },
  colorBackgroundButtonPrimaryHover: { light: '{colorPrimary700}', dark: '{colorPrimary400}' },
  colorBackgroundCalendarCurrentDate: { dark: '{colorNeutral950}' },
  colorBackgroundCellShaded: { light: '{colorNeutral200}', dark: '{colorNeutral950}' },
  colorBackgroundCodeEditorLoading: '{colorBackgroundCodeEditorStatusBar}',
  colorBackgroundContainerContent: { dark: '{colorNeutral750}' },
  colorBackgroundContainerHeader: { light: '{colorNeutral100}', dark: '{colorNeutral800}' },
  colorBackgroundDropdownItemDefault: { dark: '{colorNeutral750}' },
  colorBackgroundDropdownItemFilterMatch: { dark: '{colorPrimary1000}' },
  colorBackgroundHomeHeader: { light: '{colorBlack}', dark: '{colorBlack}' },
  colorBackgroundInputDisabled: { dark: '{colorNeutral700}' },
  colorBackgroundItemSelected: { dark: '{colorPrimary1000}' },
  colorBackgroundLayoutMain: { light: '{colorNeutral200}', dark: '{colorNeutral950}' },
  colorBackgroundLayoutMobilePanel: '{colorBackgroundLayoutPanelContent}',
  colorBackgroundLayoutToggleActive: '{colorNeutral750}',
  colorBackgroundLayoutToggleDefault: 'transparent',
  colorBackgroundLayoutToggleHover: '{colorNeutral650}',
  colorBackgroundLayoutToggleSelectedDefault: { light: '{colorPrimary600}', dark: '{colorPrimary300}' },
  colorBackgroundModalOverlay: { light: '{colorGreyOpaque90}', dark: '{colorGreyOpaque80}' },
  colorBackgroundNotificationStackBar: '{colorNeutral750}',
  colorBackgroundNotificationStackBarActive: '{colorNeutral750}',
  colorBackgroundNotificationStackBarHover: '{colorNeutral650}',
  colorBackgroundProgressBarContentInFlash: { light: '{colorGreyOpaque70}', dark: '{colorNeutral100}' },
  colorBackgroundSegmentHover: '{colorBackgroundButtonNormalHover}',
  colorBackgroundTilesDisabled: { dark: '{colorNeutral750}' },
  colorBackgroundToggleCheckedDisabled: { dark: '{colorPrimary700}' },
  colorBackgroundChatBubbleIncoming: { light: '{colorNeutral200}', dark: '{colorNeutral950}' },
  colorBorderButtonNormalActive: '{colorBorderButtonNormalDefault}',
  colorBorderButtonNormalDefault: { light: '{colorNeutral650}', dark: '{colorNeutral500}' },
  colorBorderToggleButtonNormalPressed: { light: '{colorNeutral650}', dark: '{colorNeutral500}' },
  colorBorderButtonNormalDisabled: { light: '{colorNeutral300}', dark: '{colorNeutral700}' },
  colorTextButtonNormalDisabled: { light: '{colorNeutral500}', dark: '{colorNeutral500}' },
  colorTextButtonIconDisabled: { light: '{colorNeutral500}', dark: '{colorNeutral500}' },
  colorBorderButtonNormalHover: { light: '{colorNeutral950}', dark: '{colorNeutral400}' },
  colorBorderButtonPrimaryDisabled: { light: '{colorNeutral300}', dark: '{colorNeutral700}' },
  colorTextButtonPrimaryDisabled: { light: '{colorNeutral500}', dark: '{colorNeutral500}' },
  colorItemSelected: { dark: '{colorPrimary300}' },
  colorBorderItemSelected: { dark: '{colorPrimary400}' },
  colorBorderCalendarGrid: { light: '{colorBorderDropdownItemDefault}', dark: '{colorBorderDividerDefault}' },
  colorBorderCalendarGridSelectedFocusRing: '{colorBorderItemFocused}',
  colorBorderCodeEditorPaneItemHover: { light: '{colorNeutral600}', dark: '{colorNeutral500}' },
  colorBorderContainerDivider: '{colorBorderDividerDefault}',
  colorBorderContainerTop: { light: '{colorNeutral250}', dark: '{colorNeutral750}' },
  colorBorderControlDefault: { light: '{colorNeutral600}' },
  colorBorderDividerActive: '{colorNeutral600}',
  colorBorderDividerDefault: { light: '{colorNeutral250}', dark: '{colorNeutral700}' },
  colorBorderDividerInteractiveDefault: '{colorNeutral600}',
  colorBorderDividerPanelBottom: '{colorShadowSide}',
  colorBorderDividerPanelSide: 'transparent',
  colorBorderDividerSecondary: { light: '{colorNeutral250}', dark: '{colorNeutral700}' },
  colorBorderDropdownContainer: 'transparent',
  colorBorderDropdownItemHover: { dark: '{colorNeutral500}' },
  colorBorderDropdownItemDimmedHover: `{colorBorderDropdownItemHover}`,
  colorBorderDropdownItemSelected: '{colorBorderDropdownItemDefault}',
  colorBorderDropdownItemTop: '{colorBorderDropdownItemDefault}',
  colorBorderInputDefault: { light: '{colorNeutral600}', dark: '{colorNeutral500}' },
  colorBorderInputFocused: '{colorBorderItemFocused}',
  colorBorderItemFocused: { light: '{colorPrimary600}' },
  colorBorderItemPlaceholder: '{colorTransparent}',
  colorBorderLayout: { light: '{colorNeutral300}', dark: '{colorNeutral700}' },
  colorBorderNotificationStackBar: '{colorNeutral750}',
  colorBorderPanelHeader: '{colorBorderDividerDefault}',
  colorBorderPopover: { light: '{colorNeutral300}', dark: '{colorNeutral650}' },
  colorBorderSegmentActive: '{colorBorderSegmentHover}',
  colorBorderSegmentDefault: { light: '{colorNeutral600}', dark: '{colorNeutral500}' },
  colorBorderSegmentDisabled: '{colorBorderButtonNormalDisabled}',
  colorBorderSegmentHover: { light: '{colorNeutral950}', dark: '{colorWhite}' },
  colorBorderDropdownItemFocused: { light: '{colorPrimary600}', dark: '{colorPrimary400}' },
  colorBorderStatusError: { dark: '{colorError600}' },
  colorBorderStatusSuccess: { dark: '{colorSuccess600}' },
  colorBorderTabsDivider: { light: '{colorNeutral400}', dark: '{colorNeutral700}' },
  colorBorderTabsShadow: { light: '{colorBorderDividerDefault}' },
  colorBorderTabsUnderline: '{colorTextInteractiveHover}',
  colorBorderTilesDisabled: { light: '{colorTransparent}', dark: '{colorNeutral700}' },
  colorBorderTutorial: { light: '{colorNeutral400}', dark: '{colorNeutral500}' },
  colorForegroundControlDefault: { dark: '{colorWhite}' },
  colorForegroundControlDisabled: { dark: '{colorNeutral600}' },
  colorForegroundControlReadOnly: { light: '{colorNeutral600}', dark: '{colorNeutral450}' },
  colorStrokeCodeEditorGutterActiveLineDefault: { dark: '{colorNeutral700}' },
  colorTextAccent: { light: '{colorPrimary600}', dark: '{colorPrimary300}' },
  colorTextBodyDefault: { light: '{colorNeutral950}', dark: '{colorNeutral300}' },
  colorTextBodySecondary: { light: '{colorNeutral650}', dark: '{colorNeutral300}' },
  colorTextBreadcrumbCurrent: { dark: '{colorNeutral300}' },
  colorTextBreadcrumbIcon: { light: '{colorNeutral600}' },
  colorTextButtonInlineIconDefault: '{colorTextInteractiveDefault}',
  colorTextButtonInlineIconHover: '{colorTextInteractiveHover}',
  colorTextButtonNormalActive: { light: '{colorNeutral950}', dark: '{colorNeutral100}' },
  colorTextToggleButtonNormalPressed: { light: '{colorNeutral950}', dark: '{colorNeutral100}' },
  colorTextButtonNormalDefault: { light: '{colorNeutral650}', dark: '{colorNeutral300}' },
  colorTextButtonNormalHover: { light: '{colorNeutral950}', dark: '{colorNeutral100}' },
  colorTextLinkButtonNormalDefault: '{colorTextButtonNormalDefault}',
  colorTextLinkButtonNormalHover: '{colorTextButtonNormalHover}',
  colorTextLinkButtonNormalActive: '{colorTextButtonNormalActive}',
  colorTextCalendarDateHover: '{colorTextDropdownItemHighlighted}',
  colorTextCalendarMonth: '{colorTextBodySecondary}',
  colorTextColumnHeader: { dark: '{colorNeutral450}' },
  colorTextColumnSortingIcon: { light: '{colorNeutral600}', dark: '{colorNeutral450}' },
  colorTextDisabledInlineEdit: { dark: '{colorNeutral450}' },
  colorTextGroupLabel: '{colorTextLabel}',
  colorTextExpandableSectionDefault: '{colorTextInteractiveDefault}',
  colorTextExpandableSectionHover: '{colorTextInteractiveHover}',
  colorTextExpandableSectionNavigationIconDefault: '{colorTextIconCaret}',
  colorTextHeadingDefault: { light: '{colorNeutral950}', dark: '{colorNeutral250}' },
  colorTextHeadingSecondary: { light: '{colorNeutral650}', dark: '{colorNeutral300}' },
  colorTextHomeHeaderDefault: { light: '{colorWhite}', dark: '{colorNeutral250}' },
  colorTextHomeHeaderSecondary: '{colorNeutral300}',
  colorTextFormDefault: { light: '{colorNeutral950}', dark: '{colorNeutral300}' },
  colorTextInputDisabled: { light: '{colorNeutral500}' },
  colorTextInputPlaceholder: { light: '{colorNeutral600}', dark: '{colorNeutral500}' },
  colorTextInputPlaceholderDisabled: '{colorTextInputPlaceholder}',
  colorTextLabel: { light: '{colorNeutral650}', dark: '{colorNeutral450}' },
  colorTextLayoutToggle: { light: '{colorNeutral650}', dark: '{colorNeutral300}' },
  colorTextLayoutToggleActive: { light: '{colorWhite}', dark: '{colorNeutral850}' },
  colorTextLayoutToggleHover: { light: '{colorPrimary600}', dark: '{colorPrimary400}' },
  colorTextLayoutToggleSelected: { light: '{colorWhite}', dark: '{colorNeutral950}' },
  colorTextLinkDefault: { dark: '{colorPrimary300}' },
  colorTextLinkHover: { light: '{colorPrimary700}', dark: '{colorPrimary200}' },
  colorTextLinkInvertedHover: '{colorTextNotificationDefault}',
  colorTextLinkButtonUnderline: 'currentColor',
  colorTextLinkButtonUnderlineHover: 'currentColor',
  colorTextPaginationPageNumberActiveDisabled: '{colorTextBodySecondary}',
  colorTextPaginationPageNumberDefault: { dark: '{colorTextInteractiveDefault}' },
  colorTextSegmentActive: { dark: '{colorNeutral850}' },
  colorTextSegmentDefault: '{colorTextButtonNormalDefault}',
  colorTextStatusInfo: { dark: '{colorPrimary300}' },
  colorBoardPlaceholderActive: { light: '{colorNeutral300}', dark: '{colorNeutral600}' },
  colorBoardPlaceholderHover: { light: '{colorPrimary200}', dark: '{colorPrimary600}' },
  colorDragPlaceholderActive: { light: '{colorNeutral300}', dark: '{colorNeutral600}' },
  colorDragPlaceholderHover: { light: '{colorPrimary200}', dark: '{colorPrimary600}' },
  colorBackgroundDropdownItemHover: { light: '{colorNeutral200}', dark: '{colorNeutral700}' },
};

const expandedTokens: StyleDictionary.ExpandedColorScopeDictionary = merge(
  {},
  parentTokens,
  expandColorDictionary(tokens)
);

export { expandedTokens as tokens };
export const mode: StyleDictionary.ModeIdentifier = 'color';
